//
//  TZMacroMethod.h
//  OurFramework
//
//  Created by 949699582 on 2019/7/21.
//  Copyright © 2019 com.cunyin.paywaiter. All rights reserved.
//

#ifndef TZMacroMethod_h
#define TZMacroMethod_h


#endif /* TZMacroMethod_h */

/**
 *    @brief    weakself
 */
#define WeakSelf __weak typeof(self) weakself = self;
/**
 *    @brief    系统版本
 */
#define IOS_VERSION [[[UIDevice currentDevice] systemVersion] floatValue]

/**
 *    @brief    视图信息
 */
//屏幕适配相关
#define SC_DEVICE_SIZE      [[UIScreen mainScreen] bounds].size
#define SCREEN_WIDTH [UIScreen mainScreen].bounds.size.width//宽
#define SCREEN_HEIGHT [UIScreen mainScreen].bounds.size.height//高

#define IOS7 ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0 ? YES : NO)
#define IOS8 ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0 ? YES : NO)
#define IOS9 ([[[UIDevice currentDevice] systemVersion] floatValue] >= 9.0 ? YES : NO)

#define kIsIphone4s    (CGSizeEqualToSize([UIScreen mainScreen].bounds.size, CGSizeMake(320, 480)))
#define kIsIphone5     (CGSizeEqualToSize([UIScreen mainScreen].bounds.size, CGSizeMake(320, 568)))
#define kIsIphone6     (CGSizeEqualToSize([UIScreen mainScreen].bounds.size, CGSizeMake(375, 667)))
#define kIsIphone6p    (CGSizeEqualToSize([UIScreen mainScreen].bounds.size, CGSizeMake(414, 736)))

//判断iPhoneX
#define IS_IPHONE_X ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1125, 2436), [[UIScreen mainScreen] currentMode].size) && !isPad : NO)
//判断iPHoneXr
#define IS_IPHONE_Xr ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(828, 1792), [[UIScreen mainScreen] currentMode].size) && !isPad : NO)
//判断iPhoneXs
#define IS_IPHONE_Xs ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1125, 2436), [[UIScreen mainScreen] currentMode].size) && !isPad : NO)
//判断iPhoneXs Max
#define IS_IPHONE_Xs_Max ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1242, 2688), [[UIScreen mainScreen] currentMode].size) && !isPad : NO)
//判断是否是ipad
#define isPad ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad)

#define kStatusBarHeight   (20.f)
#define kTopBarHeight      (44.f)
#define kBottomBarHeight   (49.f)

#define kScreenDrawIOS7FrameY         (64.0)
#define kScreenDrawIOS6FrameY         (44.0)

#define X(v)               (v).frame.origin.x
#define Y(v)               (v).frame.origin.y
#define WIDTH(v)           (v).frame.size.width
#define HEIGHT(v)          (v).frame.size.height

//底部安全高度
#define BOTTOM_SAFE_HEIGHT (isIPhoneX ? 34 : 0)
//tabbar高度
#define TABBAR_HEIGHT (49 + BOTTOM_SAFE_HEIGHT)
//状态栏高度
#define STATUS_HEIGHT (isIPhoneX ? 44 : 20)
//导航栏高
#define NAVBAR_HEIGHT 44

#define PNGIMAGE(NAME)           [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:(NAME) ofType:@"png"]]
#define JPGIMAGE(NAME)           [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:(NAME) ofType:@"jpg"]]

/**
 *    @brief    接口
 */

#define FCBaseURL @"http://7n1gg.cn/"
#define kBase_url(action)    [NSString stringWithFormat:@"%@/api/public/%@", FCBaseURL, action]       //测试接口
#define purl [NSString stringWithFormat:@"%@api/public/", FCBaseURL]

// 新实时段子
#define base_jokes @"https://api.apiopen.top/getJoke?"
//page=1&count=2&
#define test_jokes @"https://api.apiopen.top/getJoke?type=video"
//https://api.apiopen.top/getJoke?page=1&count=2&type=video

// 通过Id查段子
#define base_url_search @"https://api.apiopen.top/getSingleJoke?sid=28654780"

/*
 手机info
 */
#define System_Version [[UIDevice currentDevice] systemVersion]                                             //用户手机系统版本
#define System_Model   [[UIDevice currentDevice] model]                                                     //用户手机型号
#define App_Version    [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"]  //app的版本号
#define CHANNEL_ID     @"AppStore"
